package com.example.crowdfunding.service.api;

import com.example.crowdfunding.entity.Admin;
import com.github.pagehelper.PageInfo;

import java.util.List;

/**
 * The interface Admin service.
 */
public interface AdminService {

    /**
     * 新增用户
     *
     * @param admin the admin
     */
    void saveAdmin(Admin admin);

    /**
     * 主要用于验证登录
     *
     * @param acctName the acct name
     * @param userPwd  the user pwd
     * @return the admin by login acct
     */
    Admin getAdminByAcctAndPwd(String acctName, String userPwd);

    /**
     * 得到分页信息
     *
     * @param keyword  the keyword
     * @param pageNum  the page num
     * @param pageSize the page size
     * @return the page info
     */
    PageInfo<Admin> getPageInfo(String keyword, Integer pageNum, Integer pageSize);

    /**
     * 根据id删除账号
     *
     * @param adminId the admin id
     */
    void removeAdmin(Integer adminId);

    /**
     * 验证账户名是否重复
     *
     * @param acctName the acct name
     * @return the admin by acct
     */
    Boolean getAdminByAcct(String acctName);

    /**
     * 根据name查找admin
     *
     * @param acctName the acct name
     * @return the admin by acct
     */
    Admin getRealAdminByAcct(String acctName);

    /**
     * 根据id查询单个用户
     *
     * @param id id
     * @return admin admin
     */
    Admin getAdminById(Integer id);

    /**
     * 根据已有的值更新admin
     *
     * @param admin admin
     * @return admin
     */
    void updateAdminByCondition(Admin admin);

    /**
     * Save admin-role relationship.
     *
     * @param adminId the admin id
     * @param roleIds the role ids
     */
    void saveAdminRoleRelationship(Integer adminId, List<Integer> roleIds);

}
